<?php
/**
 * Remove Menu Page
 */
function agilsun_remove_menu_pages() {
	remove_menu_page('tools.php');
	//remove_menu_page('plugins.php');
	//remove_menu_page('edit-comments.php');
	remove_submenu_page( 'index.php', 'update-core.php' );
	//remove_submenu_page( 'themes.php', 'customize.php' );
}
add_action( 'admin_menu', 'agilsun_remove_menu_pages' );

/**
 * Disable Auto-Saving
 */
function agilsun_disable_autosave(){
    wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'agilsun_disable_autosave' );

/**
 * Disable Update
 */
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );

/**
 * Remove Editor From Admin Appearance Menu
 */
function agilsun_remove_the_editor() {
	remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'agilsun_remove_the_editor', 1);

/**
 * Hide Help Tabs
 */
function agilsun_remove_help_tabs() {
    $screen = get_current_screen();
    $screen->remove_help_tabs();
}
add_action('admin_head', 'agilsun_remove_help_tabs');

/**
 * Remove menu tabs from the top toolbar
 */
function agilsun_config_admin_bar() {
	//call the global adminbar var
	global $wp_admin_bar;
	// hide the WP logo
	$wp_admin_bar->remove_menu('wp-logo');
	// hide link to the dashboard
	//$wp_admin_bar->remove_menu('dashboard');
	//hide links to WP
	//$wp_admin_bar->remove_menu('about');
	$wp_admin_bar->remove_menu('wporg');
	$wp_admin_bar->remove_menu('documentation');
	$wp_admin_bar->remove_menu('support-forums');
	$wp_admin_bar->remove_menu('feedback');
}
add_action('wp_before_admin_bar_render', 'agilsun_config_admin_bar');

/**
 * Remove dashboard widget
 */
function agilsun_remove_dashboard_widgets() {
    global $wp_meta_boxes;
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    
	unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_primary']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_secondary']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
    
	# Remove "WordPress News"
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_plugins']);
	
    # Remove incoming links feed
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
    unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_incoming_links']);
}
add_action('wp_dashboard_setup', 'agilsun_remove_dashboard_widgets' );

?>

